class UserData {

    /**
     * 
     * @param {*} openId 
     * @param {*} isInit 是否初始化，true表示初始化，false表示读取文件 
     */
    constructor(openId, isInit = true) {
        this.openId = openId;
        this.hadSubscribe = false;//是否已经订阅
        this.holdRewardCooling = 0;//离线奖励的开始冷却时间
        if (isInit) {
            this.firstLoginTime = Date.now();//首次登录的时间戳，单位是毫秒
            this.activeTime = Date.now();//活跃时间，单位毫秒
        }
        else {
            this.firstLoginTime = 0;
            this.activeTime = 0;
        }
    }

    updateActiveTime() {
        this.activeTime = Date.now();
    }

    setHadSubscribe(flag) {
        this.hadSubscribe = flag;
    }

    setHoldRewardCooling(time) {
        this.holdRewardCooling = time;
    }


}

module.exports = UserData;